
//
//  SCAlertView.m
//  SC
//
//  Created by SC on 16/2/24.
//  Copyright © 2016年 SC. All rights reserved.
//

#import "SCAlertView.h"

@implementation SCAlertView

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
        
    }
    return self;
}

-(void)loadAlertLabelWithTile:(NSString *)title{
    UILabel * alertLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 50)];
    [UIView animateWithDuration:0.7 animations:^{
        alertLabel.backgroundColor = [UIColor whiteColor];
        alertLabel.font = [UIFont systemFontOfSize:17];
        alertLabel.textColor = [UIColor colorWithHexString:@"626466" alpha:1];
        
        if ([title isEqualToString:@"为自己取个酷酷的名字吧"]) {
            alertLabel.text = title;
        }else{
            NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:title];
            [str addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"3385ff" alpha:1] range:NSMakeRange(4, title.length-10)];
            [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:21] range:NSMakeRange(4, title.length-10)];
            alertLabel.attributedText = str;

        }
        
        alertLabel.textAlignment = NSTextAlignmentCenter;
        alertLabel.alpha = 0.7;
        [self addSubview:alertLabel];
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
    
}


@end
